function insertHeaderForBlog()
{    
    $.ajax({
        type : 'post',
        url : $('#website_url').val()+"sys/backend_container/getheaderforblog/",
        data : {id : $('#pageID').val()},
        success : function(response) {
                    tinyMCE.selectedInstance.selection.moveToBookmark({start:0,end:0,scrollX:0,scrollY:0,beg:true});
                    $('#admincontentarea').tinymce().execCommand('mceInsertContent',false, response);
		}
    });    
}

function insertBlogVariable()
{
    if($('#applyblog').attr('checked')){
        alert("Sorry.I can't use this widget maker.");
    } else {
        var str = '{$blogposts:'+$("#form-blog-posts input:radio:checked").val()+':';
        //str += $("#month1").val()+':'+$("#month2").val()+':'+$("#author").val()+':';
        str += $("#blog-posts-from-date").val()+':'+$("#blog-posts-to-date").val()+':'+$("#author").val()+':';
        var max = $("#max-characters").val();
        if (/^([0-9]{1,10})$/.test(max) && max > 0) {
            str += max+'}';
        } else {
            str += '300}';
        }
        $('textarea.tinymce').tinymce().execCommand('mceInsertContent',false, str);
    }
}
